<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<!DOCTYPE html>
<html>
<head>
<title>组别管理</title>
<style type="text/css">
th, td {
  border: 1px green solid;
  text-align: center;
}
</style>
</head>
<body>
  <div align="center">
    <a href="contact-handler">管理现有联系人</a>
    &nbsp;
    <jsp:include page="frame.jsp" />
    <form action="group-handler" method="post">
      <input type="hidden" name="operate" value="add-group" readonly="readonly">
      <input type="text" name="group-name" placeholder="组名">
      <input type="submit" value="添加">
    </form>
    <table align="center" cellpadding="0" cellspacing="0" width="400">
      <tr>
        <th>组名</th>
        <th colspan="2">操作</th>
      </tr>
      <c:if test="${requestScope.groups.size()>0}">
        <c:forEach items="${groups}" var="group">
          <tr>
            <td>${group.groupName}</td>
            <td>
              <form action="group-handler" method="post">
                <input type="hidden" name="operate" value="edit-group" readonly="readonly">
                <input type="hidden" name="group-id" value="${group.groupId}" readonly="readonly">
                <input type="submit" value="修改">
              </form>
            </td>
            <td>
              <form action="group-handler" method="post">
                <input type="hidden" name="operate" value="remove-group" readonly="readonly">
                <input type="hidden" name="group-id" value="${group.groupId}" readonly="readonly">
                <input type="submit" value="删除">
              </form>
            </td>
          </tr>
        </c:forEach>
      </c:if>
    </table>
  </div>
</body>
</html>
